<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="../../../js/jquery-2.2.3.min.js" type="text/javascript" charset="utf-8"></script>
		<!--<link href="../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">-->
		<link rel="stylesheet" type="text/css" href="../../../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<!--<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />-->
		<link rel="stylesheet" type="text/css" href="../../../css/footer.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/pay_now.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/pay_renhebi.css" />
		<link rel="stylesheet" type="text/css" href="../../../js/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css" />
		<script src="../../../js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			#content {
				padding-top: 1.2rem;
			}
		</style>
		<style type="text/css">
			* {
				font-family: 微软雅黑
			}
			
			.clearfix:after {
				clear: both;
			}
			
			.clearfix:before,
			.clearfix:after {
				content: " ";
				display: table;
			}
			
			.alieditContainer {
				position: relative;
			}
			
			.sixDigitPassword {
				position: absolute;
				left: -122px;
				top: 0;
				width: 1000px;
				height: 26px;
				color: #fff;
				font-size: 12px;
				-webkit-box-sizing: content-box;
				box-sizing: content-box;
				-webkit-user-select: initial;
				outline: 'none';
				z-index: 999;
				opacity: 0;
				filter: alpha(opacity=0);
			}
			
			.sixDigitPassword-box {
				cursor: text;
				background: #fff;
				outline: none;
				position: relative;
				padding: 8px 0;
				height: 30px;
				border: 1px solid #cccccc;
				border-radius: 2px;
			}
			
			.sixDigitPassword-box i {
				float: left;
				display: block;
				padding: 4px 0;
				height: 13px;
				border-left: 1px solid #cccccc;
			}
			
			.sixDigitPassword-box .active {
				background: url('../../../images/password-blink.gif') no-repeat center center;
			}
			
			.sixDigitPassword-box b {
				display: block;
				margin: 0 auto;
				width: 7px;
				height: 7px;
				overflow: hidden;
				visibility: hidden;
				background: url('../../../images/passeord-dot.png') no-repeat;
			}
			
			.sixDigitPassword-box span {
				position: absolute;
				display: block;
				left: 0px;
				top: 0px;
				height: 30px;
				border: 1px solid rgba(82, 168, 236, .8);
				border: 1px solid #00ffff\9;
				border-radius: 2px;
				visibility: hidden;
				-webkit-box-shadow: inset 0px 2px 2px rgba(0, 0, 0, 0.75), 0 0 8px rgba(82, 168, 236, 0.6);
				box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
			}
			
			.ui-securitycore .ui-form-item .ui-form-explain {
				margin-top: 8px;
			}
			
			.i-block {
				display: inline-block;
			}
			
			.six-password {
				position: relative;
				height: 33px;
				width: 182px;
				overflow: hidden;
				vertical-align: middle;
			}
			
			.ly-paybtn {
				display: block;
				color: #fff;
				border: 0;
				width: 180px;
				background: #e83023;
				margin-top: 1rem;
				-moz-border-radius: 0.416rem;
				-webkit-border-radius: 0.416rem;
				border-radius: 0.416rem;
			}
		</style>
	</head>

	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="javascript:history.go(-1)"><img class="headImg" src="../../../images/12.png" /></a>
					<p id="headTitle">立即支付</p>
				</div>
				<div id="content">
					<ul class="money">
						<li>支付金额&nbsp;:&nbsp;<span class="money1">0</span></li>
						<li class="renhe" data-toggle="modal" style="cursor: pointer;" data-target='#myModal'>仁和币使用金额
							<div class="money2" style="">0 </div>
						</li>
						<li>人民币支付金额&nbsp;:&nbsp;<span class="money3">0</span></li>
					</ul>
					<h4><span></span>&nbsp;选择支付</h4>
					<ul class="choose">
						<!--<li class="row line-active">
							<p class="choose1 col-xs-3 col-sm-3"><img src="../../../images/coalltion/yinlian.jpg" /></p>
							<p class="col-xs-8 col-sm-8">在线支付</p>
							<p class="col-xs-1 col-sm-1"><img class="choice" src="../../../images/coalltion/btn1.png" /></p>
						</li>-->
						<li class="row line-active">
							<p class="choose2 col-xs-3 col-sm-3"><img src="../../../images/coalltion/weixin.jpg" /></p>
							<p class="col-xs-8 col-sm-8">微信支付</p>
							<p class="col-xs-1 col-sm-1"><img class="choice" src="../../../images/coalltion/btn1.png" /></p>
						</li>
						<!--<li class="row line-active">
							<p class="choose3 col-xs-3 col-sm-3"><img src="../../../images/coalltion/zhifubao.jpg" /></p>
							<p class="col-xs-8 col-sm-8">支付宝支付</p>
							<p class="col-xs-1 col-sm-1"><img class="choice" src="../../../images/coalltion/btn1.png" /></p>
						</li>-->
					</ul>
					<a class="pay" id="pay11" href="JavaScript:void(0)">确认支付</a>
				</div>
			</div>
			<div id="foot" class="row">
				<a class="foot col-xs-3 col-sm-3" href="../../kaoqin/index2.html">
					<img class="footImg" src="../../../images/15.png" />
					<p>管理</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../colalition.html">
					<img class="footImg" src="../../../images/14.png" />
					<p>联盟</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../../store/store.html">
					<img class="footImg" src="../../../images/11.png" />
					<p>商城</p>
				</a>
				<a class="foot col-xs-3 col-sm-3" href="../../personage/personIndex.html">
					<img class="footImg" src="../../../images/13.png" />
					<p>我的</p>
				</a>
			</div>
		</div>
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="top: 50%;margin-top: -50%;">
			<div class="modal-dialog" style="width: 100%;margin: 0;">
				<div class="modal-content">
					<ul class="renhebi">
						<li class="row">
							<p class="col-xs-4 col-sm-4 text-right">仁和币余额&nbsp;:&nbsp;</p>
							<span class="balance col-xs-8 col-sm-8 text-left" id="rhbbalance" style="cursor: pointer;">0</span>
						</li>
						<li class="row" id="zfje">
							<p class="col-xs-4 col-sm-4 text-right">使用金额&nbsp;:&nbsp;</p>
							<input class="col-xs-6 col-sm-6 text-left" type="number" name="renhebi" id="renhebi" value="" />
						</li>
						<li class="row">
							<p class="col-xs-2 col-sm-2"></p>
							<input class="col-xs-3 col-sm-3" type="submit" id="btn" value="确定" />
							<p class="col-xs-2 col-sm-2"></p>
							<input class="col-xs-3 col-sm-3" type="button" name="back" id="back" value="返回" data-dismiss="modal" aria-hidden="true" />
							<p class="col-xs-2 col-sm-2"></p>
						</li>
					</ul>

				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal -->
		</div>
		
		<!-- 设置支付密码 -->
		<div class="modal-backdrop fade in" style="z-index: 0;"></div>
		<div class="fade" id="myModalfn" style="margin-top: -250px;">
			<div class="modal-dialog" style="width: 100%;margin: 0;">
				<div class="modal-content">
					<ul class="renhebi" style="padding:20px 15px 15px;border-bottom:0;height: auto;border-top-right-radius: 10px;border-top-left-radius: 10px;">
						<li class="row">
							<p class="col-xs-5 col-sm-5 text-right" style="padding: 0;">请设置支付密码&nbsp;:&nbsp;</p>
							<input class="col-xs-7 col-sm-7 text-left" type="number" id="mima1" onKeyUp="if(this.value.length>6){this.value=this.value.substr(0,6)};this.value=this.value.replace(/[^\d]/g,'');" />
						</li>
						<li class="row" id="zfje">
							<p class="col-xs-5 col-sm-5 text-right" style="padding: 0;">请再次确认密码&nbsp;:&nbsp;</p>
							<input class="col-xs-7 col-sm-7 text-left" type="number" id="mima2" onKeyUp="if(this.value.length>6){this.value=this.value.substr(0,6)};this.value=this.value.replace(/[^\d]/g,'');"/>
						</li>
						<li class="row">
							<input class="col-xs-3 col-sm-3 pull-right" type="button" id="ensure" value="确定" data-dismiss="modal" aria-hidden="true" />
							<p class="col-xs-2 col-sm-2"></p>
						</li>
					</ul>

				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal -->
		</div>
		
		<div id="alipayHtml"></div>
		<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

			<div class="modal-dialog">
				<div class="modal-content" style="margin: 10rem auto;">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title" id="myModalLabel">请输入支付密码</h4>
					</div>
					<div class="modal-body">
						<div style="background: #fff;">
							<form action="" method="post" name="payPassword" id="form_paypsw" style="width: 100%;">
								<div id="payPassword_container" class="alieditContainer clearfix" data-busy="0">
									<div class="i-block" data-error="i_error" style="margin-left: 22%;">
										<div class="i-block six-password">
											<input class="i-text sixDigitPassword" id="payPassword_rsainput" type="password" autocomplete="off" required="required" value="" name="payPassword_rsainput" data-role="sixDigitPassword" tabindex="" maxlength="6" minlength="6" aria-required="true">
											<div tabindex="0" class="sixDigitPassword-box" style="width: 100%;">
												<i style="width: 15%; border-color: transparent;" class=""><b style="visibility: hidden;"></b></i>
												<i style="width: 15%;"><b style="visibility: hidden;"></b></i>
												<i style="width: 15%;"><b style="visibility: hidden;"></b></i>
												<i style="width: 15%;"><b style="visibility: hidden;"></b></i>
												<i style="width: 15%;"><b style="visibility: hidden;"></b></i>
												<i style="width: 15%;"><b style="visibility: hidden;"></b></i>
												<span style="width: 10%; left: 0px; visibility: hidden;" id="cardwrap" data-role="cardwrap"></span>
											</div>
										</div>
									</div>
								</div>

							</form>
						</div>
					</div>

				</div>
				<!-- /.modal-content -->
			</div>
			<!-- /.modal -->
		</div>
		<!--<div id="wxFormDiv"></div>-->
		<form id="wxForm" name="wxForm" method="post"></form>
	</body>

	<script src="../../../js/bootstrap-3.3.7-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/jquery-validate.js" type="text/javascript"></script>
	<script src="../../../js/passwordBox.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var tokenzb = $.cookie("tokenRh");
		if(!tokenzb) {
			window.location.href = "login.html";
		}
		var memberId;
		var memberName;
		var fangshi = null;
		var siId = "siId";
		var shopId;
		$(function() {
			loadmima();
			currentyf();
			currentyf666();
		});
		
		function loadmima(){
			$.ajax({
					cache: false,
					type: "GET",
					url: "http://47.104.13.109/member-service/auth/security/checkPayPwd?token=" + tokenzb,
					dataType: "JSON",
					async: false,
					error: function(data) {
						alert("系统内部错误，请联系系统管理员！");
					},
					success: function(data) {
						if(data == true){
							document.getElementById("myModalfn").style.opacity="1";
							alert("检测到您未设置支付密码，为了您的账号安全，请立即设置。");
						}else{
							document.getElementById("myModalfn").style.opacity="0";
							document.getElementById("myModalfn").style.display="none";
							document.querySelector('.in').style.display = 'none';
						}
					}
				})
		}
		
		
		$('#ensure').click(function() {
			var mima1 = $("#mima1").val();
			var mima2 = $("#mima2").val();
			if(mima1 != mima2){
				alert("两次密码输入不一致，请重新输入！");
			}else if(mima1.length != 6 && mima1.length != 6){
				alert("输入的密码长度不符，请重新输入！");
			}else{
				$.ajax({
					cache: false,
					type: "POST",
					url: "http://47.104.13.109/member-service/auth/security/setPayPwd?newPassword="+mima1+"&rePassword="+mima2+"&token=" + tokenzb,
					async: false,
					error: function(data) {
						alert(data.responseJSON.error_message);
						document.getElementById("myModalfn").style.opacity="0";
						document.getElementById("myModalfn").style.display="none";
						document.querySelector('.in').style.display = 'none';
						
					},
					success: function(data) {
						if(data == true){
							alert("恭喜您，设置成功请牢记您的支付密码！");
							document.getElementById("myModalfn").style.opacity="0";
							document.getElementById("myModalfn").style.display="none";
							document.querySelector('.in').style.display = 'none';
						}
					}
				})
			}
		})

		$('#pay11').click(function() {

				/**
				 * init传入参数依次是：正确密码(传空时不对比输入是否正确),密码键盘背景，标题，副标题
				 * */
				PwdBox.init('', 'img/pwd_keyboard.png', '请输入支付密码', '安全支付环境，请放心使用！');
				/**
				 *res格式：{status:'true或false',password:'用户输入的密码'}
				 *
				 */
				PwdBox.show(function(res) {
					console.log(res);
					yanzheng(res.password);
					//		if(res.status){
					//			//重置输入
					//			alert('密码正确');
					//			//关闭并重置密码输入
					//			PwdBox.reset();
					//		}else{
					//			alert(JSON.stringify(arguments));
					//		}
				});
				$('.close').click(function() {
					//					alert(1);
					document.querySelector('.password-box').style.display = 'none';
					pwdBox.reset();
					window.location.reload();
				})
			})
			//获取当前会员信息
		function currentyf() {
			$.ajax({
				cache: false,
				type: "GET",
				url: "http://47.104.13.109/member-service/member/mine/member?token=" + tokenzb,
				dataType: "JSON",
				async: false,
				error: function(error) {
					$.removeCookie('tokenzb', {
						expires: 7,
						path: '/'
					});
				},
				success: function(data) {
					console.log(data);
					memberId = data.id;
					memberName = data.loginName;
				}
			});
		}

		function currentyf666() {
			$.ajax({
				cache: false,
				type: "post",

				url: "http://47.104.13.109:80/coin-service/coin/search?rhObject=" + memberId + "&rhType=member",
				dataType: "JSON",
				async: false,
				error: function(error) {

				},
				success: function(data) {
					$("#rhbbalance").html(data.rhNum);
				}
			});
		}

		$(function() {
			//选择支付方式
			var lis = document.querySelectorAll('.choose>li');
			var choice = document.querySelectorAll('.choice');
			for(var i = 0; i < lis.length; i++) {
				lis[i].index = i;
				lis[i].onclick = function() {
					for(var j = 0; j < choice.length; j++) {
						choice[j].src = "../../../images/coalltion/btn1.png";
					}
					choice[this.index].src = "../../../images/coalltion/btn2.png";
				}
			}

			//选择仁和币
			var renhe = document.querySelector('.renhe');
			var money1 = document.querySelector('.money1');
			//		renhe.onclick=function(){
			//			window.location.href="pay_renhebi.html?jine="+parseFloat(money1.innerHTML);
			//		}

			var str = window.location;
			str = unescape(str);
			var strss = null;
			var strs = str.split('&');
			shopId = strs[0].split("=")[1];
			if(strs[1]) {
				strss = strs[1].split('=');
				if(strss[0] == "count") {
					var money1 = document.querySelector('.money1');
					money1.innerHTML = strss[1];
				}
			}
			var money3 = document.querySelector('.money3');
			if(strs[1]) {
				$(".money3").html(parseFloat($(".money1").html()) - parseInt($(".money2").html()));
			}
			//console.log(strss[1])
			//获取仁和余额
			$.ajax({
				type: "post",
				url: "http://47.104.13.109/coin-service/coin/search2",
				async: true,
				data: {
					"rhObject": memberId
				},
				success: function(data) {
					if(data != null) {
						if(data.rhStatus == 0) {
							$.ajax({
								type: "post",
								url: "http://47.104.13.109/coin-service/coin/search2",
								async: true,
								data: {
									"rhObject": memberId
								},
								success: function(data) {
									$('.renhebi li:nth-child(1) span').html(data);
								}
							})

						} else if(data.rhStatus == -1) {
							$('.renhebi li:nth-child(1) span').html("抱歉您的仁和币账户为冻结状态，仁和币暂不可用！");
							document.getElementById("zfje").style.display = "none";
						}
					}
				}
			});

			//点击支付

			$(".line-active").click(function() {
				fangshi = $(this).index();
				/*alert(fangshi);*/

				console.log(fangshi);
			})

			var str = window.location;
			str = unescape(str);
			var strs = parseFloat(str.split('&')[1].split("=")[1]);

			$('#renhebi').on('input', function() {
				if(parseFloat($('#renhebi').val()) < 0 || parseFloat($('#renhebi').val()) > strs) {
					alert("您输入的钱数大于总金额");
					$('#renhebi').val("");
				}
				if(parseFloat($('#renhebi').val()) > parseFloat(document.getElementById("rhbbalance").innerText)) {
					alert("您输入的钱数大于可用金额");
					$('#renhebi').val("");
				}
			})
			$('#btn').on('click', function() {
				if($('#renhebi').val()) {
					var money2 = document.querySelector('.money2');
					money2.innerHTML = $('#renhebi').val();
					money3.innerHTML = parseFloat(strs) - parseFloat($('#renhebi').val());
					document.getElementById('myModal').style.display = "";
					$(".in").css("display", "none");

				} else {
					alert("请填写金额");
				}

			});
		})

		function zhifu(sel) {
			if(sel != true) {
				alert("请输入正确的支付密码");
				return;
			}
			var orderCoinrh = document.querySelector('.money2').innerHTML;
			var orderNum = document.querySelector('.money3').innerHTML;
			if(!(orderNum > 0)) {
				$.ajax({
					type: "PUT",
					url: "http://47.104.13.109/mall-service/order/insert",
					data: {
						"memberId": memberId,
						"memberName": memberName,
						"siId": shopId,
						"orderCoinrh": orderCoinrh,
						"orderNum": orderNum,
						"modePayment": "0"
					},
					async: true,
					success: function(data) {
						if(data != 0) {
							window.location.href = "pay_stu.html?out_trade_no=" + data + "&trade_status=TRADE_SUCCESS";
						} else {
							alert("系统内部错误请联系系统管理员！");
						}
					},
					error: function(e) {
						alert("抱歉网络异常，请重试！");
					}
				});
				return;
			}
			if(fangshi != 0) {
				alert("请选择支付方式!");
				return;
			}
			if(fangshi == "0") {
				$.ajax({
					type: "PUT",
					url: "http://47.104.13.109/mall-service/order/insert",
					data: {
						"memberId": memberId,
						"memberName": memberName,
						"siId": shopId,
						"orderCoinrh": orderCoinrh,
						"orderNum": orderNum,
						"modePayment": "1"
					},
					async: true,
					success: function(data) {
						
						$.ajax({
							type: "GET",
							url: "http://47.104.13.109/pay-service/checkoutMember?memberId="+memberId,
							async: true,
							success: function(data2) {
								if(data2 == "fail"){
									getOpenid(data);
								}else{
									window.location.href="wxwap.html?"+data;
								}
								//setTimeout("getpayurl('"+data+"')",3000);
							}
							
						});
					},
					error: function(e) {
						alert("抱歉网络异常，请重试！");
					}
				});
			}
			/*if(fangshi == "2") {
				//http://47.104.13.109/mall-service/order/insert
				$.ajax({
					type: "PUT",
					url: "http://47.104.13.109/mall-service/order/insert",
					data: {
						"memberId": memberId,
						"memberName": memberName,
						"siId": shopId,
						"orderCoinrh": orderCoinrh,
						"orderNum": orderNum,
						"modePayment": "1"
					},
					async: true,
					success: function(data) {
						if(data != 0) {
							//支付宝
							$.ajax({
								type: "POST",
								data: {
									"orderSn": data,
									"return_url": "http://47.93.216.2/RenHe/app/view/coalition/commodity_pay/pay_stu.html",
									"show_url": "http://47.93.216.2/RenHe/app/view/coalition/colalition.html"
								},
								url: "http://47.104.13.109/pay-service/aliPayHtml",
								async: true,
								success: function(data) {
									if(data != null) {
										document.getElementById('alipayHtml').innerHTML = data;
										//document.getElementsByName("").submit(); 
										setTimeout(document.forms['punchout_form'].submit(), 1000);
									}
								},
								error: function(e) {
									console.log("出错" + e)
								}
							});
						} else {
							alert("系统内部错误请联系系统管理员！");
						}
						
					},
					error: function(e) {
						alert("抱歉网络异常，请重试！");
					}
				});
			}*/
		}

		function yanzheng(liu) {
			$.ajax({
				type: "GET",
				url: "http://47.104.13.109/member-service/auth/security/check?pwd=" + liu + "&pwdType=pay&token=" + tokenzb,
				async: true,
				success: function(data) {
					zhifu(data);
				},
				error: function(e) {
					//zhifu(data);
				}
			});
		}

		function getOpenid(orderSn) {
			$.get("http://47.104.13.109/pay-service/getOpenId?memberId=" + memberId + "&orderSn=" + orderSn, {
				rediretUrl: location.href
			}, function(data) {
				//alert(data);
				if(data != "") {
					$("#wxForm").prop("action", data.url);
					$("#wxForm").submit();
				}
			}, "json");
		}

		function getpayurl(orderSn) {
			window.location.href = "wxwap.html?orderSn=" + orderSn;
		}
	</script>
	<script type="text/javascript">
		var _formPay = $('#form_paypsw');
		_formPay.validate({
			rules: {
				'payPassword_rsainput': {
					'minlength': 6,
					'maxlength': 6,
					required: true,
					digits: true,
					numPassword: true,
					echoNum: true
				}
			},

			messages: {
				'payPassword_rsainput': {
					'required': '<i class="icon icon-attention icon-lg"></i>&nbsp;请填写支付密码',
					'maxlength': '<i class="icon icon-attention icon-lg"></i>&nbsp;密码最多为{0}个字符',
					'minlength': '<i class="icon icon-attention icon-lg"></i>&nbsp;密码最少为{0}个字符',
					'digits': '<i class="icon icon-attention icon-lg"></i>&nbsp;密码只能为数字',
					'numPassword': '<i class="icon icon-attention icon-lg"></i>&nbsp;连号不可用，相同数字不可用（如：123456，11111）',
					'echoNum': '<i class="icon icon-attention icon-lg"></i>&nbsp;连号不可用，相同数字不可用（如：123456，11111）'
				}
			},
			errorPlacement: function(error, element) {
				element.closest('div[data-error="i_error"]').append(error);
			},
			submitHandler: function(form) {
				var _form = $(form);
				alert($("#payPassword_rsainput").val());
				form.submit();

			}
		});

		var payPassword = $("#payPassword_container"),
			_this = payPassword.find('i'),
			k = 0,
			j = 0,
			password = '',
			_cardwrap = $('#cardwrap');
		//点击隐藏的input密码框,在6个显示的密码框的第一个框显示光标
		payPassword.on('focus', "input[name='payPassword_rsainput']", function() {

			var _this = payPassword.find('i');
			if(payPassword.attr('data-busy') === '0') {
				//在第一个密码框中添加光标样式
				_this.eq(k).addClass("active");
				_cardwrap.css('visibility', 'visible');
				payPassword.attr('data-busy', '1');
			}

		});
		//change时去除输入框的高亮，用户再次输入密码时需再次点击
		payPassword.on('change', "input[name='payPassword_rsainput']", function() {
			_cardwrap.css('visibility', 'hidden');
			_this.eq(k).removeClass("active");
			payPassword.attr('data-busy', '0');
		}).on('blur', "input[name='payPassword_rsainput']", function() {

			_cardwrap.css('visibility', 'hidden');
			_this.eq(k).removeClass("active");
			payPassword.attr('data-busy', '0');

		});

		//使用keyup事件，绑定键盘上的数字按键和backspace按键
		payPassword.on('keyup', "input[name='payPassword_rsainput']", function(e) {

			var e = (e) ? e : window.event;

			//键盘上的数字键按下才可以输入
			if(e.keyCode == 8 || (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) {
				k = this.value.length; //输入框里面的密码长度
				l = _this.size(); //6

				for(; l--;) {

					//输入到第几个密码框，第几个密码框就显示高亮和光标（在输入框内有2个数字密码，第三个密码框要显示高亮和光标，之前的显示黑点后面的显示空白，输入和删除都一样）
					if(l === k) {
						_this.eq(l).addClass("active");
						_this.eq(l).find('b').css('visibility', 'hidden');

					} else {
						_this.eq(l).removeClass("active");
						_this.eq(l).find('b').css('visibility', l < k ? 'visible' : 'hidden');

					}

					if(k === 6) {
						j = 5;
					} else {
						j = k;
					}
					$('#cardwrap').css('left', j * 30 + 'px');

				}
				if(k == 6) {
					yanzheng(this.value);
				}
			} else {
				//输入其他字符，直接清空
				var _val = this.value;
				this.value = _val.replace(/\D/g, '');
			}
		});
	</script>

</html>